package com.css.zfzx.sjcj.modules.hddcB7_VolcanicSampleResultTable.service.impl;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.bpm.platform.utils.PlatformObjectUtils;
import com.css.zfzx.sjcj.common.excel.util.ActiveFaultEasyExcelVerifyHelper;
import com.css.zfzx.sjcj.modules.hddcB7_VolcanicSampleResultTable.viewobjects.HddcB7VolcanicsampleresulttableVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * <p>火山调查数据-火山调查采样测试结果表管理，导入校验器</p>
 *
 * @author liuhy
 * @date 2021/8/25
 */
@Component
public class VolcanicSurveySampleResultExcelVerifyHandler implements IExcelVerifyHandler<HddcB7VolcanicsampleresulttableVO> {

    private final ActiveFaultEasyExcelVerifyHelper helper;

    @Autowired
    public VolcanicSurveySampleResultExcelVerifyHandler(ActiveFaultEasyExcelVerifyHelper helper) {
        this.helper = helper;
    }

    @Override
    public ExcelVerifyHandlerResult verifyHandler(HddcB7VolcanicsampleresulttableVO vo) {
        ExcelVerifyHandlerResult result = helper.verify(vo);
        if (PlatformObjectUtils.isEmpty(vo.getSamplepointid())) {
            result.setMsg("采样点编号不能为空");
            result.setSuccess(false);
        } else if (PlatformObjectUtils.isEmpty(vo.getProjectid())) {
            result.setMsg("所属测年工程编号不能为空");
            result.setSuccess(false);
        } else if (PlatformObjectUtils.isEmpty(vo.getFieldid())) {
            result.setMsg("样品野外编号不能为空");
            result.setSuccess(false);
        } else if (PlatformObjectUtils.isEmpty(vo.getSampletype())) {
            result.setMsg("采样类型不能为空");
            result.setSuccess(false);
        }
        return result;
    }

}
